<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__ROOT__/Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
   </head>
   <script>
   function toggleIsShow(t,v){
	   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
	   $.post("{:U('Admin/Areas/editiIsShow')}",{id:v,isShow:t},function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
				    location.reload();
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
	   });
   }
   function del(id){
	   Plugins.confirm({title:'信息提示',content:'您确定要删除该地区吗?',okText:'确定',cancelText:'取消',okFun:function(){
		   Plugins.closeWindow();
		   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
		   $.post("{:U('Admin/Areas/del')}",{id:id},function(data,textStatus){
					var json = WST.toJson(data);
					if(json.status=='1'){
						Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
						   location.reload();
						}});
					}else{
						Plugins.closeWindow();
						Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
					}
		   });
	   }});
   }
   </script>
   <body class='wst-page'>
       <input type='hidden' id='parentId' value='{$pArea[areaId]}'/>
       <div class='wst-tbar' style='height:25px;'>
       <if condition="$pArea['areaId'] !=0 ">
       上级地区：{$pArea['areaName']}
       </if>
       <if condition="$pArea['areaId'] !=0 ">
       <a class="btn glyphicon btn-success" href="{:U('Admin/Areas/index',array('parentId'=>$pArea['parentId']))}" style='float:right;margin-left:5px;'>返回</a>
       </if>
       <php>if(in_array('dqlb_01',$WST_STAFF['grant'])){</php>
       <a class="btn btn-success glyphicon glyphicon-plus" href="{:U('Admin/Areas/toEdit',array('parentId'=>$pArea['areaId']))}" style='float:right'>新增</a>
       <php>}</php>
       </div>
       <div class="wst-body"> 
        <table class="table table-hover table-striped table-bordered wst-list">
           <thead>
             <tr>
               <th width='40'>序号</th>
               <th>地区</th>
               <th width='80'>是否显示</th>
               <th width='80'>排序号</th>
               <th width='250'>操作</th>
             </tr>
           </thead>
           <tbody>
            <volist name="Page['root']" id="vo" key='i'>
             <tr>
               <td>{$i}</td>
               <td>{$vo['areaName']}</td>
               <td>
               <div class="dropdown">
               <if condition="$vo['isShow']==0 ">
                   <button class="btn btn-danger dropdown-toggle wst-btn-dropdown"  type="button" data-toggle="dropdown">
					     隐藏
					  <span class="caret"></span>
				   </button>
               <else/>
                   <button class="btn btn-success dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
					     显示
					  <span class="caret"></span>
				   </button>
               </if>
               <php>if(in_array('dqlb_02',$WST_STAFF['grant'])){</php>
                   <ul class="dropdown-menu" role="menu">
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsShow(1,{$vo['areaId']})">显示</a></li>
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsShow(0,{$vo['areaId']})">隐藏</a></li>
				   </ul>
			   <php>}</php>   
               </div>
               </td>
               <td>{$vo['areaSort']}</td>
               <td>
               <if condition="$pArea['areaType'] lt 1 ">
               <a class="btn btn-default glyphicon glyphicon-pencil" href="{:U('Admin/Areas/index',array('parentId'=>$vo['areaId']))}">查看</a>&nbsp;
               </if>
               <php>if(in_array('dqlb_02',$WST_STAFF['grant'])){</php>
               <a class="btn btn-default glyphicon glyphicon-pencil" href="{:U('Admin/Areas/toEdit',array('id'=>$vo['areaId'],'parentId'=>$vo['parentId']))}"">修改</a>&nbsp;
               <php>}</php>
               <php>if(in_array('dqlb_02',$WST_STAFF['grant'])){</php>
               <button type="button" class="btn btn-default glyphicon glyphicon-trash" onclick="javascript:del({$vo['areaId']})"">刪除</button>
               <php>}</php>
               </td>
             </tr>
             </volist>
             <tr>
                <td colspan='5' align='center'>{$Page['pager']}</td>
             </tr>
           </tbody>
        </table>
       </div>
   </body>
</html>